import Request from '@/utils/request';

export default {
    /**
     * 模拟post
     * @param data
     * @returns {Promise<unknown>}
     */
    mockPost (data) {
        return Request({
            url: '',
            method: 'post',
            data: data
        })
    },
    /**
     * 模拟get
     * @param data
     * @returns {Promise<unknown>}
     */
    mockGet (data) {
        return Request({
            url: '',
            method: 'get',
            data: data
        })
    },
    /**
     * 文件上传
     * @param data
     * @returns {Promise<unknown>}
     */
    uploadFile (data) {
        console.log(data)
        return Request({
            url: '/api/upload',
            method: 'post',
            contentType: 'fileUpload',
            name: 'file',
            data: data
        })
    }
}

/**
 * 使用方法
 * import api from '@/utils/api'
 *  async getData (){
 *    const parent = {}
 *    const result = await api.uploadFile(parent)
 *  }
*/
